import { bg_image } from "./indoorConfig.js";
import {similarOut,similarInfo} from "../api/parkingRecords/index.js"
export default {
	data() {
		return {
			bg_image,
			portId: '',
			orderInfo: null,
			options:{},//参数
		}
	},
	onLoad(options) {
		this.options = options
		this.fetchSomething(options)
	},
	onPullDownRefresh(){//页面下拉刷新
		this.fetchSomething(this.options)
		uni.stopPullDownRefresh();
	},
	methods: {
		async fetchSomething(options){
			if (options.portid) {
				this.portId = options.portid
				this._getOrderInfo()
			}
		},
		/**
		 * 点击缴费，车辆出场
		 */
		async handleOut() {
			let res = await similarOut({portId: this.portId})
			uni.navigateBack()
		},
		callPhone() {
			uni.makePhoneCall({
				phoneNumber: '0595-22222100', //仅为示例，并非真实的电话号码
				success: function() {console.log("拨打电话成功！")},
				fail: function() {console.log("拨打电话失败！")}
			})
		},
		/**
		 * 获取车牌订单信息
		 */
		async _getOrderInfo() {
			let res = await similarInfo(this.portId)
			this.orderInfo = res.data || {}
		}
	}
}